Coding | Mcqs | Multiple choice questions | Informative | Computer Science | Engineering | Aptitude | Quants | Verbal

INFEED

C – VERY-EASY – PART005-Triangle – Smallest Side

 The lengths of the sides of a triangle X, Y and Z are passed as the input. The program must print the smallest side as the output.

Input Format:
The first line denotes the value of X.
The second line denotes the value of Y.
The third line denotes the value of Z.

Output Format:
The first line contains the length of the smallest side.

Boundary Conditions:
1 <= X <= 999999
1 <= Y <= 999999
1 <= Z <= 999999

Example Input/Output 1:
Input:
40
30
50

Output:
30

Example Input/Output 2:
Input:
15
15
15

Output:
15

Code

#include<stdio.h>
#include<stdlib.h>

int main()
{int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if(a<b && a<c)
printf("%d",a);
else if(b<c)
printf("%d",b);
else
printf("%d",c);
}

Post a Comment

Previous Post Next Post